<?php if(!empty($photos)):?>
<?php foreach ($photos as $index => $photo):?>
	<?php
		$slot =	ceil(($index + 1) / 30); 
		$photo = $photo['images'];
		$length = sizeof($photo) - 1;
		$max = array('width' => $photo[0]['width'] , 'url' => $photo[0]['source']);
		$min = array('width' => $photo[$length]['width'] , 'url' => $photo[$length]['source']);
	?>
	<li class="thumbnail batch batch-<?php echo $slot?>" <?php if($slot > 1) echo 'style="display:none"';?> >
		<a href="javascript:void(0);" onclick="javascript:FacebookPhotoBox.select(this);">
			<i class="icon icon-green icon-add over"></i>
			<img width="75" height="75" src="<?php echo $min['url']?>">
			<input name="data[Attach][]" type="hidden" value="<?php echo $min['url'].'|'.$max['url']?>">
		</a>
	</li>
<?php endforeach;?>
<div class="pagination pagination-centered">
	<ul>
		<?php for($i = 1; $i < $slot; $i ++):?>
			<li><a href="javascript:void(0);" 
				onclick="javascript:FacebookPhotoBox.page('<?php echo $i?>')"><?php echo $i?></a></li>
		<?php endfor;?>
	</ul>
</div>
<?php endif;?>